﻿using System;
using Newtonsoft.Json;
using Student.Common;

namespace Student.Model
{
	/// <summary>
	/// 用户令牌表
	/// </summary>
    [Serializable]
	public class UserToken 
	{
		/// <summary>
		/// ID
        /// </summary>
		public int UserTokenID
		{
			get;
			set;
		}  
        
		/// <summary>
		/// 用户ID
        /// </summary>
		public int UserDataID
		{
			get;
			set;
		}  
        
		/// <summary>
		/// 用户客户端
        /// </summary>
		public int UserClient
		{
			get;
			set;
		}  
        
		/// <summary>
		/// 令牌
        /// </summary>
		public string Token
		{
			get;
			set;
		}  
        
		/// <summary>
		/// 创建时间
        /// </summary>
		public DateTime CreateTime
		{
			get;
			set;
		}  
        
		/// <summary>
		/// 过期时间
        /// </summary>
		public DateTime ExpiredTime
		{
			get;
			set;
		}  
        
        public UserToken()
        {
			UserDataID = 0;
			UserClient = 0;
			Token = string.Empty;
			CreateTime = ConvertHelper.DefaultDate;
			ExpiredTime = ConvertHelper.DefaultDate;
        }
        
        public object Clone()
        {
            return MemberwiseClone();
        }

        public UserToken DeepClone()
        {
			var json = JsonConvert.SerializeObject(this);
			return JsonConvert.DeserializeObject<UserToken>(json);
        }
	}
}

